import {http} from '../utils/http'

// 登录
export const loginApi = async (params: LoginParams) => await http.post<LoginResult>('/authorizations', params)
// 刷新token
export const refreshTokenApi = async () => await http.put<RefreshTokenResult>('/authorizations')
// 获取验证码
export const getCodeApi = async (mobile: string) => await http.get(`/sms/codes/${mobile}`)
// 获取用户信息
export const getUserInfoApi = async () => await http.get<UserResult>('/user')
// 获取用户个人资料
export const getProfileApi = async () => await http.get<ProfileResult>('/user/profile')
// 编辑用户个人资料
export const editProfileApi = async (params: Partial<Profile>) => await http.patch<ProfileResult>('/user/profile', params)
// 更新用户头像
export const updatePhotoApi = async (file: FormData) => await http.patch<UpdatePhotoResult>('/user/photo', file)